var OnlineStoreAgeFilterConsentModule = { initialize: function () { var module = this; $(document).on('click', '.age-filter-consent-div .accept-age-filter', function (event) { module.accept_age_filter(event); }); if (this.get_consent() == null) { this.show(); } }, show: function () { $('.age-filter-consent-div').removeClass('d-none'); }, hide: function () { $('.age-filter-consent-div').addClass('d-none'); }, accept_age_filter: function (event) { this.set_consent(); this.hide(); }, get_consent: function () { var consent = null; var body = $('body'); if (!body.hasClass(ONLINE_STORE_EXTRA_CLASS_ADULTS_FILTER)) { return true; } if (StoreModule.exists(this.get_consent_store_key())) { consent = StoreModule.read(this.get_consent_store_key()); } return consent; }, set_consent: function () { StoreModule.write(this.get_consent_store_key(), {consent: 1}); }, get_consent_store_key: function () { return 'age_filter_consent'; } }; $(function () { OnlineStoreAgeFilterConsentModule.initialize(); });